<?php		
foreach ($subcategories as $id=>$subcategory) {
	if(isset($_SESSION['Inspiration']['actual_sub_id'])){
		if ($_SESSION['Inspiration']['actual_sub_id'][0]==$subcategory['Subcategory']['id']){
			$selected_category=$subcategory['Subcategory']['category_id'];
		}
	}
}

echo '
	<select name="data[Inspiration][category_id]" id="InspirationCategoryId">';
foreach ($categories as $id=>$category) {
	echo '<option value="'.$id.'"';
	if(isset($selected_category)){
		if ($id==$selected_category){
			echo ' selected';
		}
	}	
	echo '>'.$category.'</option>';
}
echo '</select>';
echo '
	<select name="data[Inspiration][subcategory_id]" id="InspirationSubcategoryId">';
foreach ($subcategories as $id=>$subcategory) {
	echo '<option value="'.$subcategory['Subcategory']['id'].'" class="'.$subcategory['Subcategory']['category_id'].'"';
	if(isset($_SESSION['Inspiration']['actual_sub_id'])){
		if ($_SESSION['Inspiration']['actual_sub_id'][0]==$subcategory['Subcategory']['id']){
			echo ' selected';
		}	
	}

	echo '>'.$subcategory['Subcategory']['title'].'</option>';
}
echo '</select>';
?>
